<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
    {include file="layout:_meta" /}
    <title>编辑设备</title>
</head>
<body>
<article class="cl pd-20">
    <form class="form form-horizontal" id="form-admin">
        
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>设备名称：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" v-model="model.name"  placeholder="设备名称">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">设备地址：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" v-model="model.address" placeholder="设备地址">
            </div>
        </div>
        
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input class="btn btn-primary radius" v-on:click="doSubmit()" value="提交">
            </div>
        </div>
    </form>
</article>

<!--_footer 作为公共模版分离出去-->
{include file="layout:_footer" /}
<!--/_footer 作为公共模版分离出去-->
<script type="text/javascript">

    var model = {
        model: {}
    };
    
    var store_model = new Vue({
        el: "#form-admin",
        data: model,
        methods: {
            //限制输入特殊字符
            btKeyUp(e) {
                e.target.value = e.target.value.replace(/[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~！@#￥%……&*（）——\-+={}|《》？：“”【】、；‘’，。、]/g,"");
            },
           
            doSubmit: function () {
                var _this = this;

                $.ajax({
                    type: 'post',
                    data: _this.model,
                    url: "{:url('equipment/set')}",
                    cache: false,
                    dataType: 'json',
                    success: function (ret) {
                        if (ret.status == true) {
                            layer.msg(ret.message, function () {
                                parent.location.href="{:url('equipment/index')}"+"?pageno="+{$pageno};
                                layer_close();
                            })
                        } else {
                            layer.msg(ret.message);
                        }
                    }
                });
            }
        }
    });

    util.get("{:url('equipment/set')}", {id:"{$id}"},function (data) {
        if(data) store_model.model = data;
    });


    

</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>